<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
@html_name: 20数值扩展
@description: The past cannot be redeemed, the future can be changed.
@author: Jason Black
@create: 2023/6/26 10:03:58
-->
<script>
    //0.Number.EPSILON是JavaScript表示的最小精度  EPSIL0N 属性的值接近 0.220446849253139808472633361816E-16
    // console.log((0.1 + 0.2) === 0.3)
    // console.log(0.1 + 0.2)

    function equals(a, b) {
        return Math.abs(a - b) < Number.EPSILON;
    }

    // console.log(equals(0.1 + 0.2), 0.3)
    //1.二进制和八进制
    let two = 0b0011
    let eight = 0o555
    let ten =  20
    let sixteen = 0xffff
    console.log(two)
    console.log(eight)
    console.log(ten)
    console.log(sixteen)

    //2.Number.isFinite检测一个数值是否为有限数

    //3.Number.isNaN检测一个数值是否为NaN

    //4.Number.parseInt Number.parseFloat字符串转整数

    //5.Number.isInteger判断一个数是否为整数

    //6.Math.trunc将数字的小数部分抹掉
    console.log("Math.trunc")
    console.log(Math.trunc(Math.PI))
    //7.Math.sign判断一个数到底为正数负数还是零
    console.log("Math.sign")
    console.log(Math.sign(10))
    console.log(Math.sign(0))
    console.log(Math.sign(-10))


</script>
</body>
</html>